<template>
  <vxe-pulldown class="edit-down-pulldown"  ref="xDown" transfer  >
    <template v-slot>
      <FortenDataviewDown
        ref="fortenDataviewDown"
        propDownType="form"
        :propFieldText="property"
        :propClear="true"
        :propForm="renderOpts.props.self.tableForm.data"
        @select-change="selectChange"
        :propUserParam="{viewKey: viewKey}"
      ></FortenDataviewDown>
    </template>
  </vxe-pulldown>
</template>

<script>
/*eslint-disable*/
export default {
  name: 'FortenDataviewDownSelect',
  props: {
    params: Object,
    renderOpts: Object
  },
  data() {
    return {
      data: [],
      property: null,
      renderProps: {},
      datas: [],
      list: [],
      searchedList: [],
      selectValue: '',
      options: 'options',
      viewKey: null
    }
  },
  mounted() {
    this.load()
  },
  methods: {
    load() {
      const {data, property } = this.params //行、列数据
      this.data = data || {}
      this.property = property
      this.renderProps = this.renderOpts.props || {}
      let columns = this.renderProps.self.columns
      this.viewKey = columns.find(ob => ob.name ==this.property).dict
    },
    selectChange({fieldText, row, propPK, that}) {
      this.selectValue = row.name
      this.$refs.fortenDataviewDown.selectValue = row.name
      this.renderOpts.props.self.tableForm.data[this.property] = row.name
      this.renderOpts.props.self.fetchData()
    }
  },
  watch:{
  }
}
</script>

<style lang="scss">
  .edit-down-pulldown{
    width: 150px;
  }
  .down-pulldown {
    width: 100%;
  }
  .down-input{
    width: 94%;
    /*更改输入框为手型*/
    .vxe-input--inner,.vxe-input--suffix{
      cursor: pointer;
    }
    .vxe-input--inner{
      /*跟表单区域宽度保持一致*/
      width: 106%;
    }
    .vxe-input--suffix{
      right: 0px;
    }
  }
  .dropdown {
    height: 200px;
    overflow: auto;
    border-radius: 4px;
    background-color: #fff;
    border: 1px solid #dcdfe6;
  }
  .list:hover {
    background-color: #f5f7fa;
  }
  .vxe-input--inner {
    height: 98%;
  }
</style>
